﻿using System;
using System.Collections.Generic;
using System.Text;

namespace IceDog.DNL.CSharp.DesignPattern.InterceptingFilterPattern.WebReq
{
    /// <summary>
    /// 过滤管理器（Filter Manager） - 过滤管理器管理过滤器和过滤器链。
    /// </summary>
    public class FilterManager
    {
        private FilterChain _filterChain;

        public FilterManager(Target target)
        {
            _filterChain = new FilterChain();
            _filterChain.SetTarget(target);
        }

        public void AddFilter(IFilter filter)
        {
            _filterChain.AddFilter(filter);
        }

        public void FilterRequest(RequestType requestType)
        {
            _filterChain.Execute(requestType);
        }
    }
}
